define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'apply.records/index',
        add_url: 'apply.records/add',
        edit_url: 'apply.records/edit',
        delete_url: 'apply.records/delete',
        group_auth:'lecturerawl'
    };

    var Controller = {

        index: function () {


            $.ajax({
                type: "GET",
                url: init.group_auth,
                success:function (relus) {
                    ea.table.render({
                        init: init,
                        toolbar : ['refresh'],
                        defaultToolbar:['filter', {
                            title: '搜索',
                            layEvent: 'TABLE_SEARCH',
                            icon: 'layui-icon-search',
                            extend: 'data-table-id="' + 'records' + '"'
                        }],
                        cols: [[
                            {type: "checkbox"},
                            {field: 'name', minWidth: 80, title: '名称',search:false},
                            {field: 'lecturer', minWidth: 80, title: '讲师',search:'select',selectList: relus},
                            {field: 'roomid', minWidth: 80, title: '房间号'},
                            {field: 'app', minWidth: 80, title: '应用名'},
                            {field: 'uri', minWidth: 80, title: '云存储路径',search:false},
                            {field: 'duration', minWidth: 80, title: '视频时长',search:false},
                            {field: 'start_time', minWidth: 80, title: '开始时间',search:false},
                            {field: 'stop_time', minWidth: 80, title: '结束时间',search:false},
                            {field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
                            {
                                width: 250,
                                title: '操作',
                                templet: ea.table.tool,
                                operat:[
                                    'delete',
                                    'edit'
                                ]
                            }
                        ]],
                    });
                }
            })
            
            
            ea.listen();
        },
        edit:function ()
        {
            ea.listen()
        }
    };
    return Controller;
});